package com.snail.mapper;
import co.elastic.clients.elasticsearch.core.SearchResponse;
import com.snail.model.entity.Product;
import com.snail.model.pojo.Result;
import org.springframework.data.elasticsearch.annotations.Query;
import org.springframework.data.elasticsearch.core.SearchHits;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
import org.springframework.stereotype.Repository;

import java.util.List;
/**
 * @author cici
 * @description 程序demo，可删除
 * @date 2025/8/13 17:50
 */
@Repository
public interface ResultMapper extends ElasticsearchRepository<Result, String>{

    // 自定义查询方法 - 根据名称包含指定字符查询

    List<Result> findByNameContaining(String keyword);

    @Query("{\"match\": {\"name\": \"?0\"}}")
    SearchHits<Result> searchByNameContains(String keyword);

//    @Query("{\"match\": {\"name\": \"?0\"}}")
//    List<Result> searchByName2(String keyword);
}
